package com.its.member.controller;

import com.its.domain.BaseResult;
import com.its.member.pojo.LoginCodeDTO;
import com.its.member.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/memberPhoneLogin")
public class MemberPhoneLoginController {
    @Autowired
    private MemberService memberService;

    //1.发送短信验证码
    @GetMapping("/sendLoginCheckCode")
    public BaseResult sendLoginCheckCode(String memberPhone){
        return memberService.sendMemberLoginCode(memberPhone);
    }

    //2.手机验证码登录
    @PostMapping("/checkLoginCode")
    public BaseResult checkLoginCode(@RequestBody LoginCodeDTO dto){
        memberService.checkMemberLoginCodeService(dto.getMemberPhone(), dto.getCode());
        return BaseResult.ok();
    }

}
